template(name="userAvatar")
  a.member(class="js-{{#if assignee}}assignee{{else}}member{{/if}}" title="{{userData.profile.fullname}} ({{userData.username}}) {{_ memberType}}")
    if userData.profile.avatarUrl
      img.avatar.avatar-image(src="{{userData.profile.avatarUrl}}")
    else
      +userAvatarInitials(userId=userData._id)

    if showStatus
      span.member-presence-status(class=presenceStatusClassName)
      span.member-type(class=memberType)

    unless isSandstorm
      if showEdit
        if $eq currentUser._id userData._id
          a.edit-avatar.js-change-avatar
            i.fa.fa-pencil

template(name="userAvatarInitials")
  svg.avatar.avatar-initials(viewBox="0 0 {{viewPortWidth}} 15")
    text(x="50%" y="13" text-anchor="middle")= initials

template(name="orgAvatar")
  a.member.orgOrTeamMember(class="js-member" title="{{orgData.orgDisplayName}}")
    +boardOrgName(orgId=orgData._id)

template(name="boardOrgRow")
  tr
    if orgData.orgIsActive
      td <s>{{ orgData.orgDisplayName }}</s>
    else
      td {{ orgData.orgDisplayName }}
    td
      if currentUser.isBoardAdmin
        a.member.orgOrTeamMember.add-member.js-manage-board-removeOrg(title="{{_ 'remove-from-board'}}")
          i.removeTeamFaMinus.fa.fa-minus
        .divaddfaplusminus
          | {{_ 'remove-btn'}}

template(name="boardTeamRow")
  tr
    if teamData.teamIsActive
      td <s>{{ teamData.teamDisplayName }}</s>
    else
      td {{ teamData.teamDisplayName }}
    td
      if currentUser.isBoardAdmin
        a.member.orgOrTeamMember.add-member.js-manage-board-removeTeam(title="{{_ 'remove-from-board'}}")
          i.removeTeamFaMinus.fa.fa-minus
        .divaddfaplusminus
          | {{_ 'remove-btn'}}

template(name="boardOrgName")
  svg.avatar.avatar-initials(viewBox="0 0 {{orgViewPortWidth}} 15")
    text(x="50%" y="13" text-anchor="middle")= orgName

template(name="teamAvatar")
  a.member.orgOrTeamMember(class="js-member" title="{{teamData.teamDisplayName}}")
    +boardTeamName(orgId=orgData._id)

template(name="boardTeamName")
  svg.avatar.avatar-initials(viewBox="0 0 {{teamViewPortWidth}} 15")
    text(x="50%" y="13" text-anchor="middle")= teamName

template(name="userPopup")
  .board-member-menu
    .mini-profile-info
      +userAvatar(userId=user._id)
      .info
        h3= user.profile.fullname
        p.quiet @{{ user.username }}

template(name="memberName")
  if showBoth
    = user.profile.fullname
    | ({{ user.username }})
  else if user.profile.fullname
    = user.profile.fullname
  else
    = user.username

template(name="changeAvatarPopup")
  if error.get
    .warning {{_ error.get}}
  ul.pop-over-list
    each uploadedAvatars
      li: a.js-select-avatar
        .member
          img.avatar.avatar-image(src="{{link}}?auth=false&brokenIsFine=true")
        | {{_ 'uploaded-avatar'}}
        if isSelected
          i.fa.fa-check
        p.sub-name
          unless isSelected
            a.js-delete-avatar {{_ 'delete'}}
            |  -
          = name
    li: a.js-select-initials
      .member
        +userAvatarInitials(userId=currentUser._id)
      | {{_ 'initials' }}
      if noAvatarUrl
        i.fa.fa-check
       p.sub-name {{_ 'default-avatar'}}
  input.hide.js-upload-avatar-input(accept="image/*;capture=camera" type="file")
  if Meteor.settings.public.avatarsUploadMaxSize
    | {{_ 'max-avatar-filesize'}} {{Meteor.settings.public.avatarsUploadMaxSize}}
    br
  if Meteor.settings.public.avatarsUploadMimeTypes
    | {{_ 'allowed-avatar-filetypes'}} {{Meteor.settings.public.avatarsUploadMimeTypes}}
    br
  | {{_ 'invalid-file'}}
  button.full.js-upload-avatar
    i.fa.fa-upload
    | {{_ 'upload-avatar'}}

template(name="cardMemberPopup")
  .board-member-menu
    .mini-profile-info
      +userAvatar(userId=user._id showEdit=true)
      .info
        h3= user.profile.fullname
        p.quiet @{{ user.username }}
    ul.pop-over-list
      unless noRemove
        if currentUser.isNotCommentOnly
          if currentUser.isNotWorker
            li: a.js-remove-member {{_ 'remove-member-from-card'}}

      if $eq currentUser._id user._id
        with currentUser
          li: a.js-edit-profile {{_ 'edit-profile'}}
